package day16;

import java.util.Scanner;

//完全数计算
public class oj2 {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        // 注意 hasNext 和 hasNextLine 的区别
        while (in.hasNext()) { // 注意 while 处理多个 case
            int n = in.nextInt();
            int count = 0;
            for(int i = 2;i <= n;i++) {
                int sum = 0;
                for(int j = 2;j*j <= i;j++) {
                    if(i%j==0) {
                        if(i/j==j) {
                            sum+=j;
                        } else {
                            sum = sum+j+i/j;
                        }
                    }
                }
                if(sum+1==i) {
                    count++;
                }
            }
            System.out.println(count);
        }
    }
}
